Skip to content

build(@schematics/angular): use genrule for best practices copy - #33690

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-schematics-best-practices-sandbox
Jul 30, 2026
Merged

build(@schematics/angular): use genrule for best practices copy#33690
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-schematics-best-practices-sandbox

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

packages/schematics/angular/BUILD.bazel uses copy_file to copy //:node_modules/@angular/core/resources/best-practices.md. When @angular/core is linked as a directory tree artifact (/dir), referencing an internal file label directly without depending on the directory artifact causes Bazel's sandbox not to stage @angular/core into the sandbox, failing with cp: cannot stat 'node_modules/@angular/core/resources/best-practices.md'.

Issue Number: N/A

What is the new behavior?

Replaces copy_file with genrule in packages/schematics/angular/BUILD.bazel to depend explicitly on //:node_modules/@angular/core/dir in srcs. This ensures Bazel stages the package directory into the sandbox for copy_to_bin / npm_package_archive builds.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot Bot added area: build & ci Related the build and CI infrastructure of the project area: @schematics/angular labels Jul 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the copy_file rule with a genrule in packages/schematics/angular/BUILD.bazel to copy the Angular best practices template. The review feedback suggests using $(execpath) instead of $(location) in the genrule command for consistency and Bazel best practices, as well as simplifying the command to a single-line string.

Comment thread packages/schematics/angular/BUILD.bazel Outdated
@alan-agius4
alan-agius4 force-pushed the fix-schematics-best-practices-sandbox branch from d27cc72 to 598d245 Compare July 30, 2026 08:14
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Jul 30, 2026
Replaces `copy_file` with `genrule` in `packages/schematics/angular/BUILD.bazel` to depend explicitly on `//:node_modules/@angular/core/dir`.

When `@angular/core` is linked as a directory tree artifact, referencing an internal file label directly without depending on the directory artifact causes Bazel's sandbox not to stage `@angular/core` into the sandbox, failing with `cp: cannot stat 'node_modules/@angular/core/resources/best-practices.md'`.
@alan-agius4
alan-agius4 force-pushed the fix-schematics-best-practices-sandbox branch from 598d245 to 1637bb2 Compare July 30, 2026 08:16
@alan-agius4
alan-agius4 merged commit 082cac9 into angular:main Jul 30, 2026
39 checks passed
@alan-agius4
alan-agius4 deleted the fix-schematics-best-practices-sandbox branch July 30, 2026 08:22
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project area: @schematics/angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants